import { USER_INFO } from '../../common/constant/cacheKeys'
import { getCache, removeCache } from '../../common/utils/cache'
Page({
  data: {
    userInfo: null
  },
  onLoad () {},
  async onShow () {
    const userInfo = await getCache(USER_INFO)
    this.setData({ userInfo })
  },
  goLogin () {
    wx.navigateTo({ url: '/pages/login/index' })
  },
  doLogout () {
    removeCache(USER_INFO)
    this.setData({ userInfo: null })
  }
})
